﻿@model _8_21_Homework.Models.Post

@{
    ViewBag.Title = "PostDetail";
}

<h2>Post Detail</h2>
<div class="row table-bordered">
    <div class="col-md-4">
        <h1 class="jumbotron">@Model.Title</h1>
    </div>
    <div class="col-md-6 text-center">
        <br /><br /><br />
        <div class="row">
            @Model.Body
        </div>
        <div class="row">
            <br /><br />
            <button class="btn-primary pull-right" onclick="location.href='/Home/LeaveComment/@Model.ID'">Leave Comment</button>
            
        </div>
    </div>
    <div class="col-md-2">
        <button class="btn-success pull-right" onclick="location.href='/Home/Index'">Back To Posts</button>
        <span class="pull-right">@Model.DateCreated</span>
    </div>
</div>

<h3>Comments</h3>
@if (Model.comments != null)
{
    <table class="table table-striped">
        <tr>
            <th>User</th>
            <th colspan="2">Comment</th>
        </tr>
        @foreach (var comment in Model.comments)
        {
            <tr>
                <td>@comment.Name</td>
                <td>@comment.Feedback</td>
                <td>@comment.DateCreated</td>
            </tr>
        }
    </table>
}
